import { reqBaseCategoryList, reqBannersList, reqFloorsList} from "@/api";
const state ={
    categoryList:[],
    bannerList:[],
    floorsList:[],
};
const mutations={
    RECEIVE_CATEGORY_LIST(state, categoryList) {
        state.categoryList = categoryList
    },
    RECEIVE_BANNER_LIST(state, bannerList) {
        state.bannerList = bannerList
    },
    RECEIVE_FLOORS_LIST(state, floorsList) {
        state.floorsList = floorsList
    },
};
const actions = {
    async getCategoryList({commit}) {
        let res = await reqBaseCategoryList();
        if(res.code == 200) {
            commit('RECEIVE_CATEGORY_LIST', res.data)
        }
    },

    // 获取首页轮播图数据
    async getBannerList({commit}) {
        let res = await reqBannersList();
        if(res.code == 200) {
            commit('RECEIVE_BANNER_LIST', res.data)
        }
    },
    
    // 获取首页Floors数据
    async getFloorsList({commit}) {
        let res = await reqFloorsList();
        if(res.code == 200) {
            commit('RECEIVE_FLOORS_LIST', res.data)
        }
    },
};
const getters={};
export default {
    state,
    mutations,
    actions,
    getters
}